import axios from 'axios';
import qs from 'query-string';
import { Pagination, PaginationData } from '@/types/global';

export interface TenantVo {
  id: string;
  description: string;
  endTime: string;
  name: string;
  phone: string;
  status: string;
}

export interface TenantListParams {
  endTime: string;
  name: string;
  page: number;
  phone: string;
  rows: number;
  status: string;
}

export interface TenantListRes {
  rows: TenantVo[];
  total: number;
}

export function selectPageTenant(params: TenantListParams) {
  return axios.post<TenantListRes>('tenant/tenant/selectPageTenant', params);
}

export function createTenant(params: TenantVo) {
  return axios.post<string>('tenant/tenant/createTenant', params);
}

export function editTenant(params: TenantVo) {
  return axios.post<string>('tenant/tenant/editTenant', params);
}

export function delTenant(id: string) {
  return axios.get<string>(`tenant/tenant/deleteTenant?id=${id}`);
}
// 分页查询公告
export function pullAnnouncementList(params: Pagination) {
  return axios.post(
    `tenant/systemAnnouncement/selectSystemAnnouncementByPage`,
    params
  );
}
export interface AnnouncementList {
  createOrgId: string;
  createOrgName: string;
  createTime: string;
  creator: string;
  creatorName: string;
  deleteFlag: string;
  fileId: string;
  id: string;
  showFlag: string;
  tenantId: string;
  text: string;
  title: string;
  versionTime: string;
}
